{template header}
<style type="text/css">
    .table-striped td,
    .table-striped th { text-align: center;}
    .table-striped td:nth-child(2) { min-width:100px; max-width: 350px;}
</style>

<h4 style="padding-left:10px;">
    <span>查询</span>
</h4>
<form method="post" action="/?c=actLottery&a=lotteryPrizeUserList&lid={$lid}" class="query-form">
    <p>
        用户UID：
        <input type="text" class="gene-idsub" style="width: 100px;" placeholder="UID" name="uUid" value="{eval if (!empty($queryParam['uUid'])) echo $queryParam['uUid']}"> 
        用户姓名:
        <input type="text" class="gene-idsup" style="width: 100px;" placeholder="姓名" name="uName" value="{eval if (!empty($queryParam['uName'])) echo $queryParam['uName']}">
        用户手机号：
        <input type="text" class="gene-idsub" style="width: 100px;"  placeholder="手机号" name="uPhone" value="{eval if (!empty($queryParam['uPhone'])) echo $queryParam['uPhone']}"> 
        奖项：
        <select name="prizeLevel" style="width: 100px;">
        </select>

        <a class="btn query-go" style="margin-top:-10px;margin-left:20px">查询</a>　
    </p>
</form>
<hr style="clear:both;" />

<a class="btn btn-large btn-link" style="float: right;"  href="?c=actLottery&a=lotteryPrizeUserList&export=1{eval echo '&' . http_build_query($queryParam)}">导出excel</a>

<div class="bs-docs-example" style="clear:both;">
    <table class="table table-striped">
        <thead>
            <tr>
                <th>奖项</th>
                <th>用户ID</th>
                <th>用户姓名</th>
                <th>用户昵称</th>
                <th>用户手机号</th>
                <th>用户详细地址</th>
            </tr>
        </thead>
        <tbody>
            {loop $userList $k $v}
            <tr>
                <td>{$v['prize_desc']}</td>
                <td>{$v['uid']}</td>
                <td>{$v['realname']}</td>
                <td>{eval echo $uInfos[$v['uid']]}</td>
                <td>{$v['phone']}</td>
                <td>{$v['detail_addr']}</td>
            </tr>
            {/loop}
        </tbody>
    </table>
</div>
<div class="pagination">
    <ul>
        {$pageStr}
    </ul>
</div>
<script type="text/javascript">
    $(function() {
        var awardLevel = '{$awardLevel}';
        var pLevel = {eval if (!empty($queryParam['prizeLevel'])) echo $queryParam['prizeLevel']; else echo 0;};
        //抽奖码中奖信息设置
        $('select[name="prizeLevel"]').html(getPrizeOption());
        $('.query-go').on('click', function(){
            $('.query-form').submit();
        })
        //奖项option选项
        function getPrizeOption() {
            var aLevel = JSON.parse(awardLevel);
            var optStr = '<option value="0">无</option>';

            for (var i=0; i < aLevel.length; i++) {
                if ((i+1) == pLevel) {
                    optStr += '<option value=' + (i+1) + ' selected="selected">' + aLevel[i] + '</option>';
                } else {
                    optStr += '<option value=' + (i+1) + '>' + aLevel[i] + '</option>';
                }
            }

            return optStr;
        }
    });
    
</script>
{template footer}
